package com.xunhuan;

import com.atguigu.gmall.model.product.BaseTrademark;
import com.atguigu.gmall.product.mapper.BaseTrademarkMapper;
import com.atguigu.gmall.product.service.BaseTrademarkService;
import com.atguigu.gmall.product.service.impl.BaseTrademarkServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

//@RunWith(SpringRunner.class)
@SpringBootTest
public class OtherPerson {
    /**
     * 简单写个for循环诅咒你们1W次
     */
    @Test
    public void zuzhounimen(){
        for (int i = 1; i <= 10000; i++) {
            System.out.println("一帮傻吊："+i+"次");
        }
    }
    @Autowired
    private BaseTrademarkService baseTrademarkService;

    @Autowired
    private BaseTrademarkMapper baseTrademarkMapper;
    @Test
    public void test01(){
        Page<BaseTrademark> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<BaseTrademark>(1,10);

        IPage<BaseTrademark> page1 = baseTrademarkService.getPage(page);
        System.out.println("page1.getCurrent() = " + page1.getCurrent());
        System.out.println("page1.getPages() = " + page1.getPages());
        System.out.println("page1.getRecords() = " + page1.getRecords());
        System.out.println("page1.getSize() = " + page1.getSize());
        System.out.println("page1.getTotal() = " + page1.getTotal());
    }
    @Test
    public void test02(){
        Page<BaseTrademark> page = new Page<>(1,10);
        IPage<BaseTrademark> page1 = baseTrademarkMapper.selectPage(page, new QueryWrapper<BaseTrademark>().orderByDesc("id"));
        System.out.println("page1.getCurrent() = " + page1.getCurrent());
        System.out.println("page1.getPages() = " + page1.getPages());
        System.out.println("page1.getRecords() = " + page1.getRecords());
        System.out.println("page1.getSize() = " + page1.getSize());
        System.out.println("page1.getTotal() = " + page1.getTotal());
    }

}
